/*   1:    */ package org.jetbrains.debugger;
/*   2:    */ 
/*   3:    */

import com.intellij.icons.AllIcons.Debugger;
import com.intellij.icons.AllIcons.Nodes;
import com.intellij.openapi.util.ActionCallback;
import com.intellij.openapi.util.ActionCallback.Chunk;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.util.Consumer;
import com.intellij.util.PairConsumer;
import com.intellij.util.SmartList;
import com.intellij.util.ThreeState;
import com.intellij.xdebugger.ObsolescentAsyncResults;
import com.intellij.xdebugger.frame.*;
import com.intellij.xdebugger.frame.XFullValueEvaluator.XFullValueEvaluationCallback;
import com.intellij.xdebugger.frame.XValueModifier.XModificationCallback;
import com.intellij.xdebugger.frame.presentation.XKeywordValuePresentation;
import com.intellij.xdebugger.frame.presentation.XNumericValuePresentation;
import com.intellij.xdebugger.frame.presentation.XStringValuePresentation;
import com.intellij.xdebugger.frame.presentation.XValuePresentation;
import com.intellij.xdebugger.frame.presentation.XValuePresentation.XValueTextRenderer;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.debugger.values.*;

import javax.swing.*;
import java.util.Collections;
import java.util.List;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.regex.Pattern;

/*   4:    */
/*   5:    */
/*   6:    */
/*   7:    */
/*   8:    */
/*   9:    */
/*  10:    */
/*  11:    */
/*  12:    */
/*  13:    */
/*  14:    */
/*  15:    */
/*  16:    */
/*  17:    */
/*  18:    */
/*  19:    */
/*  20:    */
/*  21:    */
/*  22:    */
/*  23:    */
/*  24:    */
/*  25:    */
/*  26:    */
/*  27:    */
/*  28:    */
/*  29:    */
/*  30:    */
/*  31:    */
/*  32:    */
/*  33:    */
/*  34:    */
/*  35:    */
/*  36:    */
/*  37:    */
/*  38:    */
/*  39:    */
/*  40:    */
/*  41:    */
/*  42:    */
/*  43:    */
/*  44:    */
/*  45:    */ 
/*  46:    */ public final class VariableView
/*  47:    */   extends XNamedValue
/*  48:    */   implements VariableContext
/*  49:    */ {
/*  50: 27 */   private static final Pattern a = Pattern.compile("^[a-zA-Z]+\\[\\d+\\]$");
/*  51:    */   private final VariableContext b;
/*  52:    */   private final Variable c;
/*  53:    */   private volatile Value d;
/*  54:    */   private volatile List<Variable> e;
/*  55:    */   private volatile int f;
/*  56:    */   
/*  57:    */   private static final class ArrayPresentation
/*  58:    */     extends XValuePresentation
/*  59:    */   {
/*  60:    */     private final String a;
/*  61:    */     
/*  62:    */     ArrayPresentation(int paramInt, VariableView.1 param1)
/*  63:    */     {
/*  64: 28 */       this(paramInt);
/*  65:    */     }
/*  66:    */     
/*  67:    */     private ArrayPresentation(int paramInt)
/*  68:    */     {
/*  69: 32 */       this.a = Integer.toString(paramInt);
/*  70:    */     }
/*  71:    */     
/*  72:    */     public void renderValue(@NotNull XValuePresentation.XValueTextRenderer paramXValueTextRenderer)
/*  73:    */     {
/*  74: 37 */       if (paramXValueTextRenderer == null) {
/*  75: 37 */         throw new IllegalArgumentException(String.format("Argument %s for @NotNull parameter of %s.%s must not be null", new Object[] { "0", "org/jetbrains/debugger/VariableView$ArrayPresentation", "renderValue" }));
/*  76:    */       }
/*  77: 37 */       paramXValueTextRenderer.renderSpecialSymbol("Array[");
/*  78: 38 */       paramXValueTextRenderer.renderSpecialSymbol(this.a);
/*  79: 39 */       paramXValueTextRenderer.renderSpecialSymbol("]");
/*  80:    */     }
/*  81:    */   }
/*  82:    */   
/*  83:    */   public VariableView(@NotNull Variable paramVariable, @NotNull VariableContext paramVariableContext)
/*  84:    */   {
/*  85: 53 */     super(paramVariableContext.getMemberFilter().normalizeMemberName(paramVariable));
/*  86:    */     
/*  87: 55 */     this.b = paramVariableContext;
/*  88: 56 */     this.c = paramVariable;
/*  89:    */   }
/*  90:    */   
/*  91:    */   @NotNull
/*  92:    */   public static String getClassName(@NotNull ObjectValue paramObjectValue)
/*  93:    */   {
/*  94: 61 */     if (paramObjectValue == null) {
/*  95: 61 */       throw new IllegalArgumentException(String.format("Argument %s for @NotNull parameter of %s.%s must not be null", new Object[] { "0", "org/jetbrains/debugger/VariableView", "getClassName" }));
/*  96:    */     }
/*  97: 61 */     String str = paramObjectValue.getClassName(); String 
/*  98: 62 */       tmp60_59 = (StringUtil.isEmpty(str) ? "Object" : str);
/*  99: 62 */     if (tmp60_59 == null) {
/* 100: 62 */       throw new IllegalStateException(String.format("@NotNull method %s.%s must not return null", new Object[] { "org/jetbrains/debugger/VariableView", "getClassName" }));
/* 101:    */     }
/* 102: 62 */     return tmp60_59;
/* 103:    */   }
/* 104:    */   
/* 105:    */   @NotNull
/* 106:    */   public static String getObjectValueDescription(@NotNull ObjectValue paramObjectValue)
/* 107:    */   {
/* 108: 67 */     if (paramObjectValue == null) {
/* 109: 67 */       throw new IllegalArgumentException(String.format("Argument %s for @NotNull parameter of %s.%s must not be null", new Object[] { "0", "org/jetbrains/debugger/VariableView", "getObjectValueDescription" }));
/* 110:    */     }
/* 111: 67 */     String str = paramObjectValue.getValueString(); String 
/* 112: 68 */       tmp62_61 = (StringUtil.isEmpty(str) ? getClassName(paramObjectValue) : str);
/* 113: 68 */     if (tmp62_61 == null) {
/* 114: 68 */       throw new IllegalStateException(String.format("@NotNull method %s.%s must not return null", new Object[] { "org/jetbrains/debugger/VariableView", "getObjectValueDescription" }));
/* 115:    */     }
/* 116: 68 */     return tmp62_61;
/* 117:    */   }
/* 118:    */   
/* 119:    */   public static void setObjectPresentation(@NotNull ObjectValue paramObjectValue, @NotNull Icon paramIcon, @NotNull XValueNode paramXValueNode)
/* 120:    */   {
/* 121: 72 */     if (paramObjectValue == null) {
/* 122: 72 */       throw new IllegalArgumentException(String.format("Argument %s for @NotNull parameter of %s.%s must not be null", new Object[] { "0", "org/jetbrains/debugger/VariableView", "setObjectPresentation" }));
/* 123:    */     }
/* 124: 72 */     if (paramIcon == null) {
/* 125: 72 */       throw new IllegalArgumentException(String.format("Argument %s for @NotNull parameter of %s.%s must not be null", new Object[] { "1", "org/jetbrains/debugger/VariableView", "setObjectPresentation" }));
/* 126:    */     }
/* 127: 72 */     if (paramXValueNode == null) {
/* 128: 72 */       throw new IllegalArgumentException(String.format("Argument %s for @NotNull parameter of %s.%s must not be null", new Object[] { "2", "org/jetbrains/debugger/VariableView", "setObjectPresentation" }));
/* 129:    */     }
/* 130: 72 */     paramXValueNode.setPresentation(paramIcon, new ObjectValuePresentation(getObjectValueDescription(paramObjectValue)), paramObjectValue.hasProperties() != ThreeState.NO);
/* 131:    */   }
/* 132:    */   
/* 133:    */   public static void setArrayPresentation(@NotNull Value paramValue, @NotNull VariableContext paramVariableContext, @NotNull Icon paramIcon, @NotNull XValueNode paramXValueNode)
/* 134:    */   {
/* 135: 76 */     if (paramValue == null) {
/* 136: 76 */       throw new IllegalArgumentException(String.format("Argument %s for @NotNull parameter of %s.%s must not be null", new Object[] { "0", "org/jetbrains/debugger/VariableView", "setArrayPresentation" }));
/* 137:    */     }
/* 138: 76 */     if (paramVariableContext == null) {
/* 139: 76 */       throw new IllegalArgumentException(String.format("Argument %s for @NotNull parameter of %s.%s must not be null", new Object[] { "1", "org/jetbrains/debugger/VariableView", "setArrayPresentation" }));
/* 140:    */     }
/* 141: 76 */     if (paramIcon == null) {
/* 142: 76 */       throw new IllegalArgumentException(String.format("Argument %s for @NotNull parameter of %s.%s must not be null", new Object[] { "2", "org/jetbrains/debugger/VariableView", "setArrayPresentation" }));
/* 143:    */     }
/* 144: 76 */     if (paramXValueNode == null) {
/* 145: 76 */       throw new IllegalArgumentException(String.format("Argument %s for @NotNull parameter of %s.%s must not be null", new Object[] { "3", "org/jetbrains/debugger/VariableView", "setArrayPresentation" }));
/* 146:    */     }
/* 147: 76 */     assert (paramValue.getType() == ValueType.ARRAY);
/* 148: 78 */     if ((paramValue instanceof ArrayValue))
/* 149:    */     {
/* 150: 79 */       int i = ((ArrayValue)paramValue).getLength();
/* 151: 80 */       paramXValueNode.setPresentation(paramIcon, new ArrayPresentation(i, null), i > 0);
/* 152: 81 */       return;
/* 153:    */     }
/* 154: 84 */     String str = paramValue.getValueString();
/* 155: 86 */     if ((str != null) && (str.endsWith("]")) && (a.matcher(str).find())) {
/* 156: 87 */       paramXValueNode.setPresentation(paramIcon, null, str, true);
/* 157:    */     } else {
/* 158: 90 */       ObsolescentAsyncResults.consume(paramVariableContext.getEvaluateContext().evaluate("a.length", Collections.singletonMap("a", paramValue)), paramXValueNode, new PairConsumer()
/* 159:    */       {
/* 160:    */         public void consume(Value paramAnonymousValue, XValueNode paramAnonymousXValueNode)
/* 161:    */         {
/* 162: 94 */           paramAnonymousXValueNode.setPresentation(this.val$icon, null, "Array[" + paramAnonymousValue.getValueString() + ']', true);
/* 163:    */         }
/* 164:    */       });
/* 165:    */     }
/* 166:    */   }
/* 167:    */   
/* 168:    */   @NotNull
/* 169:    */   public static Icon getIcon(@NotNull Value paramValue)
/* 170:    */   {
/* 171:102 */     if (paramValue == null) {
/* 172:102 */       throw new IllegalArgumentException(String.format("Argument %s for @NotNull parameter of %s.%s must not be null", new Object[] { "0", "org/jetbrains/debugger/VariableView", "getIcon" }));
/* 173:    */     }
/* 174:102 */     ValueType localValueType = paramValue.getType();
/* 175:103 */     switch (9.$SwitchMap$org$jetbrains$debugger$values$ValueType[localValueType.ordinal()])
/* 176:    */     {
/* 177:    */     case 1: 
/* 178:105 */       Icon tmp83_80 = AllIcons.Nodes.Function;
/* 179:105 */       if (tmp83_80 == null) {
/* 180:105 */         throw new IllegalStateException(String.format("@NotNull method %s.%s must not return null", new Object[] { "org/jetbrains/debugger/VariableView", "getIcon" }));
/* 181:    */       }
/* 182:105 */       return tmp83_80;
/* 183:    */     case 2: 
/* 184:107 */       Icon tmp121_118 = AllIcons.Debugger.Db_array;
/* 185:107 */       if (tmp121_118 == null) {
/* 186:107 */         throw new IllegalStateException(String.format("@NotNull method %s.%s must not return null", new Object[] { "org/jetbrains/debugger/VariableView", "getIcon" }));
/* 187:    */       }
/* 188:107 */       return tmp121_118;
/* 189:    */     }
/* 190:109 */     Icon tmp172_169 = (localValueType.isObjectType() ? AllIcons.Debugger.Value : AllIcons.Debugger.Db_primitive);
/* 191:109 */     if (tmp172_169 == null) {
/* 192:109 */       throw new IllegalStateException(String.format("@NotNull method %s.%s must not return null", new Object[] { "org/jetbrains/debugger/VariableView", "getIcon" }));
/* 193:    */     }
/* 194:109 */     return tmp172_169;
/* 195:    */   }
/* 196:    */   
/* 197:    */   public boolean watchableAsEvaluationExpression()
/* 198:    */   {
/* 199:115 */     return this.b.watchableAsEvaluationExpression();
/* 200:    */   }
/* 201:    */   
/* 202:    */   @NotNull
/* 203:    */   public DebuggerViewSupport getDebugProcess()
/* 204:    */   {
/* 205:121 */     DebuggerViewSupport tmp9_4 = this.b.getDebugProcess();
/* 206:121 */     if (tmp9_4 == null) {
/* 207:121 */       throw new IllegalStateException(String.format("@NotNull method %s.%s must not return null", new Object[] { "org/jetbrains/debugger/VariableView", "getDebugProcess" }));
/* 208:    */     }
/* 209:121 */     return tmp9_4;
/* 210:    */   }
/* 211:    */   
/* 212:    */   @Nullable
/* 213:    */   public VariableContext getParent()
/* 214:    */   {
/* 215:127 */     return this.b;
/* 216:    */   }
/* 217:    */   
/* 218:    */   @NotNull
/* 219:    */   public MemberFilter getMemberFilter()
/* 220:    */   {
/* 221:133 */     MemberFilter tmp9_4 = this.b.getMemberFilter();
/* 222:133 */     if (tmp9_4 == null) {
/* 223:133 */       throw new IllegalStateException(String.format("@NotNull method %s.%s must not return null", new Object[] { "org/jetbrains/debugger/VariableView", "getMemberFilter" }));
/* 224:    */     }
/* 225:133 */     return tmp9_4;
/* 226:    */   }
/* 227:    */   
/* 228:    */   public void computePresentation(@NotNull XValueNode paramXValueNode, @NotNull XValuePlace paramXValuePlace)
/* 229:    */   {
/* 230:138 */     if (paramXValueNode == null) {
/* 231:138 */       throw new IllegalArgumentException(String.format("Argument %s for @NotNull parameter of %s.%s must not be null", new Object[] { "0", "org/jetbrains/debugger/VariableView", "computePresentation" }));
/* 232:    */     }
/* 233:138 */     if (paramXValuePlace == null) {
/* 234:138 */       throw new IllegalArgumentException(String.format("Argument %s for @NotNull parameter of %s.%s must not be null", new Object[] { "1", "org/jetbrains/debugger/VariableView", "computePresentation" }));
/* 235:    */     }
/* 236:138 */     this.d = this.c.getValue();
/* 237:139 */     if (this.d == null)
/* 238:    */     {
/* 239:140 */       ObjectValue localObjectValue = (ObjectValue)((VariableView)this.b).getValue();
/* 240:141 */       assert (localObjectValue != null);
/* 241:142 */       ObsolescentAsyncResults.consume(((ObjectProperty)this.c).evaluateGet(localObjectValue, getEvaluateContext()), paramXValueNode, new PairConsumer()
/* 242:    */       {
/* 243:    */         public void consume(Value paramAnonymousValue, XValueNode paramAnonymousXValueNode)
/* 244:    */         {
/* 245:145 */           VariableView.this.d = paramAnonymousValue;
/* 246:146 */           VariableView.this.a(paramAnonymousValue, paramAnonymousXValueNode);
/* 247:    */         }
/* 248:    */       });
/* 249:    */     }
/* 250:    */     else
/* 251:    */     {
/* 252:151 */       a(this.d, paramXValueNode);
/* 253:    */     }
/* 254:    */   }
/* 255:    */   
/* 256:    */   @NotNull
/* 257:    */   static String trimFunctionDescription(@NotNull Value paramValue)
/* 258:    */   {
/* 259:157 */     if (paramValue == null) {
/* 260:157 */       throw new IllegalArgumentException(String.format("Argument %s for @NotNull parameter of %s.%s must not be null", new Object[] { "0", "org/jetbrains/debugger/VariableView", "trimFunctionDescription" }));
/* 261:    */     }
/* 262:157 */     String str = paramValue.getValueString();
/* 263:158 */     if (str == null)
/* 264:    */     {
/* 265:159 */       String tmp55_52 = "";
/* 266:159 */       if (tmp55_52 == null) {
/* 267:159 */         throw new IllegalStateException(String.format("@NotNull method %s.%s must not return null", new Object[] { "org/jetbrains/debugger/VariableView", "trimFunctionDescription" }));
/* 268:    */       }
/* 269:159 */       return tmp55_52;
/* 270:    */     }
/* 271:162 */     int i = 0;
/* 272:163 */     while ((i < str.length()) && (!StringUtil.isLineBreak(str.charAt(i)))) {
/* 273:164 */       i++;
/* 274:    */     }
/* 275:166 */     while ((i > 0) && (Character.isWhitespace(str.charAt(i - 1)))) {
/* 276:167 */       i--;
/* 277:    */     }
/* 278:169 */     String tmp147_144 = str.substring(0, i);
/* 279:169 */     if (tmp147_144 == null) {
/* 280:169 */       throw new IllegalStateException(String.format("@NotNull method %s.%s must not return null", new Object[] { "org/jetbrains/debugger/VariableView", "trimFunctionDescription" }));
/* 281:    */     }
/* 282:169 */     return tmp147_144;
/* 283:    */   }
/* 284:    */   
/* 285:    */   private void a(@NotNull Value paramValue, @NotNull XValueNode paramXValueNode)
/* 286:    */   {
/* 287:173 */     if (paramValue == null) {
/* 288:173 */       throw new IllegalArgumentException(String.format("Argument %s for @NotNull parameter of %s.%s must not be null", new Object[] { "0", "org/jetbrains/debugger/VariableView", "computePresentation" }));
/* 289:    */     }
/* 290:173 */     if (paramXValueNode == null) {
/* 291:173 */       throw new IllegalArgumentException(String.format("Argument %s for @NotNull parameter of %s.%s must not be null", new Object[] { "1", "org/jetbrains/debugger/VariableView", "computePresentation" }));
/* 292:    */     }
/* 293:173 */     String str = paramValue.getValueString();
/* 294:174 */     switch (9.$SwitchMap$org$jetbrains$debugger$values$ValueType[paramValue.getType().ordinal()])
/* 295:    */     {
/* 296:    */     case 3: 
/* 297:    */     case 4: 
/* 298:177 */       this.b.getDebugProcess().computeObjectPresentation((ObjectValue)paramValue, this.c, this.b, paramXValueNode, a());
/* 299:178 */       break;
/* 300:    */     case 1: 
/* 301:181 */       paramXValueNode.setPresentation(a(), new ObjectValuePresentation(trimFunctionDescription(paramValue)), true);
/* 302:182 */       break;
/* 303:    */     case 2: 
/* 304:185 */       this.b.getDebugProcess().computeArrayPresentation(paramValue, this.c, this.b, paramXValueNode, a());
/* 305:186 */       break;
/* 306:    */     case 5: 
/* 307:    */     case 6: 
/* 308:    */     case 7: 
/* 309:191 */       paramXValueNode.setPresentation(a(), new XKeywordValuePresentation(str), false);
/* 310:192 */       break;
/* 311:    */     case 8: 
/* 312:195 */       paramXValueNode.setPresentation(a(), a(str), false);
/* 313:196 */       break;
/* 314:    */     case 9: 
/* 315:199 */       paramXValueNode.setPresentation(a(), new XStringValuePresentation(str), false);
/* 316:202 */       if ((((paramValue instanceof StringValue)) && (((StringValue)paramValue).isTruncated())) || (str.length() > 100)) {
/* 317:203 */         paramXValueNode.setFullValueEvaluator(new MyFullValueEvaluator(paramValue));
/* 318:    */       }
/* 319:    */       break;
/* 320:    */     default: 
/* 321:209 */       paramXValueNode.setPresentation(a(), null, str, true);
/* 322:    */     }
/* 323:    */   }
/* 324:    */   
/* 325:    */   private static XValuePresentation a(@NotNull String paramString)
/* 326:    */   {
/* 327:214 */     if (paramString == null) {
/* 328:214 */       throw new IllegalArgumentException(String.format("Argument %s for @NotNull parameter of %s.%s must not be null", new Object[] { "0", "org/jetbrains/debugger/VariableView", "createNumberPresentation" }));
/* 329:    */     }
/* 330:214 */     return (paramString.equals("NaN")) || (paramString.equals("Infinity")) ? new XKeywordValuePresentation(paramString) : new XNumericValuePresentation(paramString);
/* 331:    */   }
/* 332:    */   
/* 333:    */   public void computeChildren(@NotNull final XCompositeNode paramXCompositeNode)
/* 334:    */   {
/* 335:219 */     if (paramXCompositeNode == null) {
/* 336:219 */       throw new IllegalArgumentException(String.format("Argument %s for @NotNull parameter of %s.%s must not be null", new Object[] { "0", "org/jetbrains/debugger/VariableView", "computeChildren" }));
/* 337:    */     }
/* 338:219 */     paramXCompositeNode.setAlreadySorted(true);
/* 339:    */     
/* 340:221 */     List localList = this.e;
/* 341:222 */     if (localList != null)
/* 342:    */     {
/* 343:223 */       i = Math.min(this.f + 100, localList.size());
/* 344:224 */       j = i == localList.size() ? 1 : 0;
/* 345:225 */       paramXCompositeNode.addChildren(Variables.createVariablesList(localList, this.f, i, this), j);
/* 346:226 */       if (j == 0)
/* 347:    */       {
/* 348:227 */         paramXCompositeNode.tooManyChildren(localList.size() - i);
/* 349:228 */         this.f += 100;
/* 350:    */       }
/* 351:230 */       return;
/* 352:    */     }
/* 353:233 */     int i = ((this.d instanceof ObjectValue)) && (((ObjectValue)this.d).hasProperties() != ThreeState.NO) ? 1 : 0;
/* 354:234 */     int j = this.d instanceof ArrayValue;
/* 355:235 */     ActionCallback.Chunk localChunk = new ActionCallback.Chunk();
/* 356:236 */     if (j != 0) {
/* 357:237 */       localChunk.add(a((ArrayValue)this.d, paramXCompositeNode, i == 0));
/* 358:    */     }
/* 359:240 */     if (i != 0) {
/* 360:241 */       localChunk.add(a((ObjectValue)this.d, paramXCompositeNode, j == 0));
/* 361:    */     }
/* 362:244 */     if (j == i) {
/* 363:245 */       localChunk.create().doWhenProcessed(new Runnable()
/* 364:    */       {
/* 365:    */         public void run()
/* 366:    */         {
/* 367:248 */           if (!paramXCompositeNode.isObsolete()) {
/* 368:249 */             paramXCompositeNode.addChildren(XValueChildrenList.EMPTY, true);
/* 369:    */           }
/* 370:    */         }
/* 371:    */       });
/* 372:    */     }
/* 373:    */   }
/* 374:    */   
/* 375:    */   public static abstract class ObsolescentIndexedVariablesConsumer
/* 376:    */     extends ArrayValue.IndexedVariablesConsumer
/* 377:    */   {
/* 378:    */     protected final XCompositeNode node;
/* 379:    */     
/* 380:    */     protected ObsolescentIndexedVariablesConsumer(@NotNull XCompositeNode paramXCompositeNode)
/* 381:    */     {
/* 382:260 */       this.node = paramXCompositeNode;
/* 383:    */     }
/* 384:    */     
/* 385:    */     public boolean isObsolete()
/* 386:    */     {
/* 387:265 */       return this.node.isObsolete();
/* 388:    */     }
/* 389:    */   }
/* 390:    */   
/* 391:    */   private ActionCallback a(@NotNull final ArrayValue paramArrayValue, @NotNull XCompositeNode paramXCompositeNode, final boolean paramBoolean)
/* 392:    */   {
/* 393:270 */     if (paramArrayValue == null) {
/* 394:270 */       throw new IllegalArgumentException(String.format("Argument %s for @NotNull parameter of %s.%s must not be null", new Object[] { "0", "org/jetbrains/debugger/VariableView", "computeIndexedProperties" }));
/* 395:    */     }
/* 396:270 */     if (paramXCompositeNode == null) {
/* 397:270 */       throw new IllegalArgumentException(String.format("Argument %s for @NotNull parameter of %s.%s must not be null", new Object[] { "1", "org/jetbrains/debugger/VariableView", "computeIndexedProperties" }));
/* 398:    */     }
/* 399:270 */     paramArrayValue.getVariables(0, paramArrayValue.getLength(), 100, new ObsolescentIndexedVariablesConsumer(paramXCompositeNode)
/* 400:    */     {
/* 401:    */       public void consumeRanges(@Nullable int[] paramAnonymousArrayOfInt)
/* 402:    */       {
/* 403:273 */         if (paramAnonymousArrayOfInt == null)
/* 404:    */         {
/* 405:274 */           XValueChildrenList localXValueChildrenList = new XValueChildrenList();
/* 406:275 */           LazyVariablesGroup.addGroups(paramArrayValue, LazyVariablesGroup.GROUP_FACTORY, localXValueChildrenList, 0, paramArrayValue.getLength(), 100, VariableView.this);
/* 407:276 */           this.node.addChildren(localXValueChildrenList, paramBoolean);
/* 408:    */         }
/* 409:    */         else
/* 410:    */         {
/* 411:279 */           LazyVariablesGroup.addRanges(paramArrayValue, paramAnonymousArrayOfInt, this.node, VariableView.this, paramBoolean);
/* 412:    */         }
/* 413:    */       }
/* 414:    */       
/* 415:    */       public void consumeVariables(@NotNull List<Variable> paramAnonymousList)
/* 416:    */       {
/* 417:285 */         if (paramAnonymousList == null) {
/* 418:285 */           throw new IllegalArgumentException(String.format("Argument %s for @NotNull parameter of %s.%s must not be null", new Object[] { "0", "org/jetbrains/debugger/VariableView$4", "consumeVariables" }));
/* 419:    */         }
/* 420:285 */         this.node.addChildren(Variables.createVariablesList(paramAnonymousList, VariableView.this), paramBoolean);
/* 421:    */       }
/* 422:    */     });
/* 423:    */   }
/* 424:    */   
/* 425:    */   private ActionCallback a(@NotNull final ObjectValue paramObjectValue, @NotNull XCompositeNode paramXCompositeNode, final boolean paramBoolean)
/* 426:    */   {
/* 427:291 */     if (paramObjectValue == null) {
/* 428:291 */       throw new IllegalArgumentException(String.format("Argument %s for @NotNull parameter of %s.%s must not be null", new Object[] { "0", "org/jetbrains/debugger/VariableView", "computeNamedProperties" }));
/* 429:    */     }
/* 430:291 */     if (paramXCompositeNode == null) {
/* 431:291 */       throw new IllegalArgumentException(String.format("Argument %s for @NotNull parameter of %s.%s must not be null", new Object[] { "1", "org/jetbrains/debugger/VariableView", "computeNamedProperties" }));
/* 432:    */     }
/* 433:291 */     ObsolescentAsyncResults.consume(paramObjectValue.getProperties(), paramXCompositeNode, new PairConsumer()
/* 434:    */     {
/* 435:    */       public void consume(List<Variable> paramAnonymousList, XCompositeNode paramAnonymousXCompositeNode)
/* 436:    */       {
/* 437:294 */         if ((paramObjectValue.getType() == ValueType.ARRAY) && (!(paramObjectValue instanceof ArrayValue)))
/* 438:    */         {
/* 439:295 */           VariableView.this.a(paramAnonymousList, paramAnonymousXCompositeNode);
/* 440:296 */           return;
/* 441:    */         }
/* 442:299 */         FunctionValue localFunctionValue = (paramObjectValue instanceof FunctionValue) ? (FunctionValue)paramObjectValue : null;
/* 443:300 */         if ((localFunctionValue != null) && (localFunctionValue.hasScopes() == ThreeState.NO)) {
/* 444:301 */           localFunctionValue = null;
/* 445:    */         }
/* 446:304 */         VariableView.this.e = Variables.sortFilterAndAddValueList(paramAnonymousList, paramAnonymousXCompositeNode, VariableView.this, 100, localFunctionValue == null);
/* 447:305 */         if (VariableView.this.e != null) {
/* 448:306 */           VariableView.this.f = 100;
/* 449:    */         }
/* 450:309 */         if (localFunctionValue != null) {
/* 451:311 */           paramAnonymousXCompositeNode.addChildren(XValueChildrenList.bottomGroup(new FunctionScopesValueGroup(localFunctionValue, VariableView.this.b)), paramBoolean);
/* 452:    */         }
/* 453:    */       }
/* 454:    */     });
/* 455:    */   }
/* 456:    */   
/* 457:    */   private void a(@NotNull List<? extends Variable> paramList, @NotNull XCompositeNode paramXCompositeNode)
/* 458:    */   {
/* 459:318 */     if (paramList == null) {
/* 460:318 */       throw new IllegalArgumentException(String.format("Argument %s for @NotNull parameter of %s.%s must not be null", new Object[] { "0", "org/jetbrains/debugger/VariableView", "computeArrayRanges" }));
/* 461:    */     }
/* 462:318 */     if (paramXCompositeNode == null) {
/* 463:318 */       throw new IllegalArgumentException(String.format("Argument %s for @NotNull parameter of %s.%s must not be null", new Object[] { "1", "org/jetbrains/debugger/VariableView", "computeArrayRanges" }));
/* 464:    */     }
/* 465:318 */     List localList = Variables.filterAndSort(paramList, this, false);
/* 466:319 */     int i = localList.size();
/* 467:320 */     int j = 100;
/* 468:321 */     if (i <= j)
/* 469:    */     {
/* 470:322 */       paramXCompositeNode.addChildren(Variables.createVariablesList(localList, this), true);
/* 471:323 */       return;
/* 472:    */     }
/* 473:326 */     for (; i > 0; i--) {
/* 474:327 */       if (Character.isDigit(((Variable)localList.get(i - 1)).getName().charAt(0))) {
/* 475:    */         break;
/* 476:    */       }
/* 477:    */     }
/* 478:332 */     XValueChildrenList localXValueChildrenList = new XValueChildrenList();
/* 479:333 */     if (i > 0) {
/* 480:334 */       LazyVariablesGroup.addGroups(localList, VariablesGroup.GROUP_FACTORY, localXValueChildrenList, 0, i, j, this);
/* 481:    */     }
/* 482:    */     int k;
/* 483:338 */     if (localList.size() - i > j)
/* 484:    */     {
/* 485:339 */       for (k = localList.size(); k > 0; k--) {
/* 486:340 */         if (!((Variable)localList.get(k - 1)).getName().startsWith("__")) {
/* 487:    */           break;
/* 488:    */         }
/* 489:    */       }
/* 490:345 */       if (k > 0) {
/* 491:346 */         LazyVariablesGroup.addGroups(localList, VariablesGroup.GROUP_FACTORY, localXValueChildrenList, i, k, j, this);
/* 492:    */       }
/* 493:    */     }
/* 494:    */     else
/* 495:    */     {
/* 496:350 */       k = i;
/* 497:    */     }
/* 498:353 */     for (int m = k; m < localList.size(); m++) {
/* 499:354 */       localXValueChildrenList.add(new VariableView((Variable)localList.get(m), this));
/* 500:    */     }
/* 501:357 */     paramXCompositeNode.addChildren(localXValueChildrenList, true);
/* 502:    */   }
/* 503:    */   
/* 504:    */   @NotNull
/* 505:    */   private Icon a()
/* 506:    */   {
/* 507:362 */     Icon tmp7_4 = getIcon(this.d);
/* 508:362 */     if (tmp7_4 == null) {
/* 509:362 */       throw new IllegalStateException(String.format("@NotNull method %s.%s must not return null", new Object[] { "org/jetbrains/debugger/VariableView", "getIcon" }));
/* 510:    */     }
/* 511:362 */     return tmp7_4;
/* 512:    */   }
/* 513:    */   
/* 514:    */   @Nullable
/* 515:    */   public XValueModifier getModifier()
/* 516:    */   {
/* 517:368 */     if (!this.c.isMutable()) {
/* 518:369 */       return null;
/* 519:    */     }
/* 520:372 */     new XValueModifier()
/* 521:    */     {
/* 522:    */       public String getInitialValueEditorText()
/* 523:    */       {
/* 524:375 */         if (VariableView.this.d.getType() == ValueType.STRING)
/* 525:    */         {
/* 526:376 */           String str = VariableView.this.d.getValueString();
/* 527:377 */           StringBuilder localStringBuilder = new StringBuilder(str.length());
/* 528:378 */           localStringBuilder.append('"');
/* 529:379 */           StringUtil.escapeStringCharacters(str.length(), str, localStringBuilder);
/* 530:380 */           localStringBuilder.append('"');
/* 531:381 */           return localStringBuilder.toString();
/* 532:    */         }
/* 533:384 */         return VariableView.this.d.getType().isObjectType() ? null : VariableView.this.d.getValueString();
/* 534:    */       }
/* 535:    */       
/* 536:    */       public void setValue(@NotNull String paramAnonymousString, @NotNull final XValueModifier.XModificationCallback paramAnonymousXModificationCallback)
/* 537:    */       {
/* 538:390 */         if (paramAnonymousString == null) {
/* 539:390 */           throw new IllegalArgumentException(String.format("Argument %s for @NotNull parameter of %s.%s must not be null", new Object[] { "0", "org/jetbrains/debugger/VariableView$6", "setValue" }));
/* 540:    */         }
/* 541:390 */         if (paramAnonymousXModificationCallback == null) {
/* 542:390 */           throw new IllegalArgumentException(String.format("Argument %s for @NotNull parameter of %s.%s must not be null", new Object[] { "1", "org/jetbrains/debugger/VariableView$6", "setValue" }));
/* 543:    */         }
/* 544:390 */         ValueModifier localValueModifier = VariableView.this.c.getValueModifier();
/* 545:391 */         assert (localValueModifier != null);
/* 546:392 */         localValueModifier.setValue(VariableView.this.c, paramAnonymousString, VariableView.this.getEvaluateContext()).doWhenDone(new Runnable()
/* 547:    */         {
/* 548:    */           public void run()
/* 549:    */           {
/* 550:395 */             VariableView.this.d = null;
/* 551:396 */             paramAnonymousXModificationCallback.valueModified();
/* 552:    */           }
/* 553:396 */         }).doWhenRejected(VariableView.a(paramAnonymousXModificationCallback));
/* 554:    */       }
/* 555:    */     };
/* 556:    */   }
/* 557:    */   
/* 558:    */   private static Consumer<String> a(@NotNull XValueCallback paramXValueCallback)
/* 559:    */   {
/* 560:404 */     if (paramXValueCallback == null) {
/* 561:404 */       throw new IllegalArgumentException(String.format("Argument %s for @NotNull parameter of %s.%s must not be null", new Object[] { "0", "org/jetbrains/debugger/VariableView", "createErrorMessageConsumer" }));
/* 562:    */     }
/* 563:404 */     new Consumer()
/* 564:    */     {
/* 565:    */       public void consume(@Nullable String paramAnonymousString)
/* 566:    */       {
/* 567:407 */         this.val$callback.errorOccurred(paramAnonymousString == null ? "Internal error" : paramAnonymousString);
/* 568:    */       }
/* 569:    */     };
/* 570:    */   }
/* 571:    */   
/* 572:    */   @NotNull
/* 573:    */   public EvaluateContext getEvaluateContext()
/* 574:    */   {
/* 575:415 */     EvaluateContext tmp9_4 = this.b.getEvaluateContext();
/* 576:415 */     if (tmp9_4 == null) {
/* 577:415 */       throw new IllegalStateException(String.format("@NotNull method %s.%s must not return null", new Object[] { "org/jetbrains/debugger/VariableView", "getEvaluateContext" }));
/* 578:    */     }
/* 579:415 */     return tmp9_4;
/* 580:    */   }
/* 581:    */   
/* 582:    */   @Nullable
/* 583:    */   public Value getValue()
/* 584:    */   {
/* 585:420 */     return this.c.getValue();
/* 586:    */   }
/* 587:    */   
/* 588:    */   public boolean canNavigateToSource()
/* 589:    */   {
/* 590:425 */     return ((this.d instanceof FunctionValue)) || (getDebugProcess().canNavigateToSource(this.c, this.b));
/* 591:    */   }
/* 592:    */   
/* 593:    */   public void computeSourcePosition(@NotNull final XNavigatable paramXNavigatable)
/* 594:    */   {
/* 595:430 */     if (paramXNavigatable == null) {
/* 596:430 */       throw new IllegalArgumentException(String.format("Argument %s for @NotNull parameter of %s.%s must not be null", new Object[] { "0", "org/jetbrains/debugger/VariableView", "computeSourcePosition" }));
/* 597:    */     }
/* 598:430 */     if ((this.d instanceof FunctionValue)) {
/* 599:431 */       ((FunctionValue)this.d).resolve().doWhenDone(new Consumer()
/* 600:    */       {
/* 601:    */         public void consume(final FunctionValue paramAnonymousFunctionValue)
/* 602:    */         {
/* 603:434 */           VariableView.this.getDebugProcess().getVm().getScriptManager().getScript(paramAnonymousFunctionValue).doWhenDone(new Consumer()
/* 604:    */           {
/* 605:    */             public void consume(Script paramAnonymous2Script)
/* 606:    */             {
/* 607:437 */               VariableView.8.this.val$navigatable.setSourcePosition(paramAnonymous2Script == null ? null : VariableView.this.getDebugProcess().getSourceInfo(null, paramAnonymous2Script, paramAnonymousFunctionValue.getOpenParenLine(), paramAnonymousFunctionValue.getOpenParenColumn()));
/* 608:    */             }
/* 609:    */           });
/* 610:    */         }
/* 611:    */       });
/* 612:    */     } else {
/* 613:444 */       getDebugProcess().computeSourcePosition(this.c, this.b, paramXNavigatable);
/* 614:    */     }
/* 615:    */   }
/* 616:    */   
/* 617:    */   @Nullable
/* 618:    */   public String getEvaluationExpression()
/* 619:    */   {
/* 620:451 */     if (!watchableAsEvaluationExpression()) {
/* 621:452 */       return null;
/* 622:    */     }
/* 623:455 */     SmartList localSmartList = new SmartList(this.c.getName());
/* 624:456 */     VariableContext localVariableContext = this.b;
/* 625:457 */     while ((localVariableContext != null) && (localVariableContext.getName() != null))
/* 626:    */     {
/* 627:458 */       localSmartList.add(localVariableContext.getName());
/* 628:459 */       localVariableContext = localVariableContext.getParent();
/* 629:    */     }
/* 630:461 */     return this.b.getDebugProcess().propertyNamesToString(localSmartList, false);
/* 631:    */   }
/* 632:    */   
/* 633:    */   private static class MyFullValueEvaluator
/* 634:    */     extends XFullValueEvaluator
/* 635:    */   {
/* 636:    */     private final Value a;
/* 637:    */     
/* 638:    */     public MyFullValueEvaluator(@NotNull Value paramValue)
/* 639:    */     {
/* 640:468 */       super();
/* 641:    */       
/* 642:470 */       this.a = paramValue;
/* 643:    */     }
/* 644:    */     
/* 645:    */     public void startEvaluation(@NotNull final XFullValueEvaluator.XFullValueEvaluationCallback paramXFullValueEvaluationCallback)
/* 646:    */     {
/* 647:475 */       if (paramXFullValueEvaluationCallback == null) {
/* 648:475 */         throw new IllegalArgumentException(String.format("Argument %s for @NotNull parameter of %s.%s must not be null", new Object[] { "0", "org/jetbrains/debugger/VariableView$MyFullValueEvaluator", "startEvaluation" }));
/* 649:    */       }
/* 650:475 */       if ((!(this.a instanceof StringValue)) || (!((StringValue)this.a).isTruncated()))
/* 651:    */       {
/* 652:476 */         paramXFullValueEvaluationCallback.evaluated(this.a.getValueString());
/* 653:477 */         return;
/* 654:    */       }
/* 655:480 */       final AtomicBoolean localAtomicBoolean = new AtomicBoolean();
/* 656:481 */       ((StringValue)this.a).getFullString().doWhenDone(new Runnable()
/* 657:    */       {
/* 658:    */         public void run()
/* 659:    */         {
/* 660:484 */           if ((!paramXFullValueEvaluationCallback.isObsolete()) && (localAtomicBoolean.compareAndSet(false, true))) {
/* 661:485 */             paramXFullValueEvaluationCallback.evaluated(VariableView.MyFullValueEvaluator.this.a.getValueString());
/* 662:    */           }
/* 663:    */         }
/* 664:485 */       }).doWhenRejected(VariableView.a(paramXFullValueEvaluationCallback));
/* 665:    */     }
/* 666:    */   }
/* 667:    */   
/* 668:    */   @Nullable
/* 669:    */   public Scope getScope()
/* 670:    */   {
/* 671:495 */     return this.b.getScope();
/* 672:    */   }
/* 673:    */ }



/* Location:           E:\idea\

 * Qualified Name:     org.jetbrains.debugger.VariableView

 * JD-Core Version:    0.7.0.1

 */